package com.example.springai.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.springai.common.R;
import com.example.springai.domain.AiDocumentChunk;
import com.example.springai.service.IAiDocumentChunkService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * AI文档块控制
 *
 * @author ZWX
 */
@RestController
@RequestMapping("/ai/document/chunk")
@RequiredArgsConstructor
public class AiDocumentChunkController {
    private final IAiDocumentChunkService aiDocumentChunkService;

    /**
     * 根据文档ID获取文档块列表
     *
     * @param documentId 文档ID
     * @return 文档块列表
     */
    @GetMapping("/by/documentId/{documentId}")
    public R<List<AiDocumentChunk>> listByDocumentId(@PathVariable("documentId") Long documentId) {
        return R.ok(aiDocumentChunkService.getByDocumentId(documentId));
    }
}
